# 作   者：要努力，努力，再努力
# 开发日期：2022/4/23 22:37
class CPU:
    pass


class Disk:
    pass


class Computer:
    def __init__(self, cpu, disk):
        self.cpu = cpu
        self.disk = disk


# 变量的赋值
cpu1 = CPU()
cpu2 = cpu1

print(cpu1, id(cpu1))
print(cpu2, id(cpu2))

# 浅拷贝 默认 只拷贝内容
print('---------------------------')
disk = Disk()
computer = Computer(cpu1, disk)

import copy
print(disk)
computer2 = copy.copy(computer)
print(computer, computer.cpu, computer.disk)
print(computer2, computer2.cpu, computer2.disk)


# 深拷贝
print('---------------------------')
computer3 = copy.deepcopy(computer)
print(computer, computer.cpu, computer.disk)
print(computer3, computer3.cpu, computer3.disk)
